package com.baidu.project.chart1;

public class Nawa {
    public static Person getPerson(String person) throws Exception {
        if (person.equalsIgnoreCase("M")){
            return new Man();
        } else if (person.equalsIgnoreCase("W")) {
            return new Woman();
        } else if (person.equalsIgnoreCase("R")) {
            return new Robot();
        }else {
            throw new Exception("不能造该类");
        }
    }
}
